<h5>Interfacing the Wiring hardware and Isadora</h5>
<p>This tutorial introduces the basic interfacing between the Wiring hardware and Isadora <a href="http://www.troikatronix.com">http://www.troikatronix.com</a>. The brief for the tutorial will be to read values from a photoresistor (light sensor) connected to Wiring analog input pin 0 and send them to Isadora. It assumes the Wiring software and Isadora are installed and the proper Wiring setup has been previously completed. For more Information on Wiring install check out the <a href="http://wiring.org.co/learning/tutorials/">tutorials</a> about Wiring installation and software setup.</p>
<h5>Step 1</h5>
<p>First let's prepare a small circuit for connecting the photoresistor to the Wiring board:</p>
<p><img src="imgs/PhotoresistorIsadora.gif" /></p>
<p>&nbsp;</p>
<h5>Step 2</h5>
<p>Copy and paste the following code on the Wiring editor: Verify your program is free of compiling errors by pressing the Compile/Verify button in the menu bar. Press the Upload button in the menu bar. In case of syntax errors the Wiring environment will print the error messages otherwise it will print the Upload was completed successfully, the uploading process triggers activity in the Rx/Tx LEDs on the Wiring hardware. The new program will start automatically after uploading. Use the Serial Monitor button to watch the data coming from the Wiring board, then close the Serial Monitor again.</p>
<code>
<pre>
/** 
 * Photoresistor / Isadora

 * 
 * Reads values from a photoresistor connected to the 
 * analog input pin 0. The value read from the sensor is proportional
 * to the amount of light that hits the sensor surface.
 * The value read is printed through the serial to be monitored
 * in the console or received on Isadora
 */

int val; 

void setup()
{
  Serial.begin(9600);      // sets the serial port to 9600
}

void loop() 
{
  val = analogRead(0);     // read analog input pin 0
  Serial.print(1, DEC);    // print a '1', this character will be
                           // used as a parsing character
  Serial.println(val, DEC);  // prints the value read from the
                             // sensor in analog pin 0
  delay(200);              // wait 200ms for next reading
}
</pre>
</code>
<h5>&nbsp;</h5>
<h5>Step 3</h5>
<p>Next step is to setup things in Isadora. Start Isadora. In the &quot;Search&quot; box type Serial and find &quot;Serial In Watcher - Text&quot;, select it and drop the object on the main Isadora work area:</p>
<p><img src="imgs/Isadora-01.jpg" /></p>
<p>&nbsp;</p>
<h5>Step 4</h5>
<p>Double click the Serial In watcher and a popup window will open, inside type the following small program:
<code><pre>"1"

value : integer = 4 digits</pre></code>
<p><img src="imgs/Isadora-02.jpg" /></p>
<p>&nbsp;</p>
<p>&quot;1&quot; is used to identify the Serial In Watcher parsing character we are printing in the Wiring code.</p>
<p>&quot;value&quot; is  a variable name, any name will be fine. Given &quot;integer = 4 digits&quot; the value will be appear like: 1XXX, where XXX is the actual value read from the sensor. If sending a value from a digital input, just change &quot;integer =  digits&quot;, since the digital signal will be 1 (HIGH) or 0 (LOW).</p>
<p>Note that a new output named &quot;value&quot; is added to the Serial In Watcher object.</p>
<p><img src="imgs/Isadora-03.jpg"  /></p>
<p>&nbsp;</p>
<h5>Step 5</h5>
<p>Go to the &quot;Output&quot; menu and select &quot;Serial Port Setup&quot;: </p>
<p><img src="imgs/Isadora-04.jpg"  /></p>
<p>&nbsp;</p>
<p>The Serial Port Setup  popup Window opens, click on the Select menu and select the Wiring board serial port, on Windows it will appear as COMx, where x must be the number assigned to the Wiring board, on macosx it will appear as usbserial-xxxxxxxx. The other settings can be left as the default, the Speed parameter will be left to 9600 since this is the speed used previously in the Wiring program on step 1 (Serial.begin(9600);). Click OK to close the dialog box to continue.</p>
<p><img src="imgs/Isadora-05.jpg"  /></p>
<p>&nbsp;</p>
<h5>Step 6</h5>
<p>Change the field &quot;eom char&quot; in the Serial In Watcher object from 13 to 10: </p>
<img src="imgs/Isadora-08.jpg" width="846" height="620" />
<p>&nbsp;</p>
<h5>Step 7</h5>
<p>Go to the &quot;Output&quot; menu and select &quot;Enable Serial Ports&quot; this will activate the serial connection: </p>
<p><img src="imgs/Isadora-06.jpg" /></p>
<p>&nbsp;</p>
<p>Note the &quot;msg rcv&quot; field in the Serial In Watcher object is blinking and printing &quot;X&quot; and &quot;-&quot; alternating:</p>
<p><img src="imgs/Isadora-07.jpg" /></p>
<p>&nbsp;</p>
<p>Interact with the sensor to change the input value. Note how the sensor can be changed for any other analog sensor, such as a potentiometer, distance etc. For more information about Isadora, check their forum at <a href="http://forum.troikatronix.com/">http://forum.troikatronix.com/</a>.</p>
<p>&nbsp;</p>
<p>Next &gt;&gt; <a href="isadora2.html">Sending data to the Wiring board from Isadora</a></p>
